	*------------------------------------------------------------------------------------------------------------%	
	* Figure 7: Effect of large retailer $15 MW on wages at other employers in CZ 
	*------------------------------------------------------------------------------------------------------------%	
	
	* Preliminaries ------------------------------------------------------------
	
	use "$data/cb/stacked_nonpolicy_firm_dataset.dta", clear
	keep if balanced_short==1
	drop if trt_exp==4
		
	keep if inrange(etime, -6, 5)
	global wage ln_avg_wage_exact
	label variable ln_avg_wage_exact "log average hourly wage"

	* Programs ------------------------------------------------------------------
	
	* Define event study program
	cap program drop vmw_eventstudy
	program define vmw_eventstudy
		
		args outcome ytitle restriction expname controls subdirectory filename
		
		if !regexm("`filename'", "fig") {
			local filename "`outcome'_`expname'"
		}
		
		reghdfe `outcome' $common if balanced_short == 1 & (`restriction'), absorb(`controls') vce(cluster cz)
		PlotCoeff,  title(" ") xline(-0.5) xline(-2.5) vrs("T_") yti(`ytitle') name(`expname')
		graph export "$figures_tables/`subdirectory'`filename'.pdf", replace  
		
	end	

	cap program drop vmw_eventstudy_wage
	program define vmw_eventstudy_wage
		
		args outcome ytitle restriction expname controls subdirectory filename
		
		if !regexm("`filename'", "fig") {
			local filename "`outcome'_`expname'"
		}
		
		reghdfe `outcome' $common if balanced_short == 1 & (`restriction'), absorb(`controls') vce(cluster cz)
		PlotCoeff,  title(" ") xline(-0.5) xline(-2.5) vrs("T_") yti(`ytitle') name(`expname') ylabel(-.002 0 .002 .004 .006 .008 .01)
		graph export "$figures_tables/`subdirectory'`filename'.pdf", replace  
		
	end		
		
	* Run ----------------------------------------------------------------------

	* All non-policy establishments
	preserve
	keep if mw==15
	egen T_std=std(T)
	replace T=T_std	
		
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"
		
	* Fig 7
	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw==15" "fig8" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "" "fig7a_spillover_wage_15_all"
	tab trt_exp if e(sample)==1
	restore
	
	* Sample industries
	preserve
	keep if mw==15 & sample_ind==1
	egen T_std=std(T)
	replace T=T_std	
		
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"
	
	* Fig 7
	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw==15 & sample_ind==1" "fig8" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "" "fig7b_spillover_wage_15_sample_ind"
	tab trt_exp if e(sample)==1
	restore
	
	* Connected establishments
	preserve
	keep if mw==15 & (poaching_estab==1 | feeder_estab==1)
	egen T_std=std(T)
	replace T=T_std	
		
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"

	* Fig 7
	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw == 15 & (poaching_estab==1 | feeder_estab==1)" "fig8" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "" "fig7c_spillover_wage_15_pos_flows"
	tab trt_exp if e(sample)==1	
	restore
	
	*------------------------------------------------------------------------------------------------------------%	
	* Figure D6: Longer time horizon, scaled 
	*------------------------------------------------------------------------------------------------------------%	

	* Preliminaries ------------------------------------------------------------

	use "$data/cb/stacked_nonpolicy_firm_dataset.dta", clear
	keep if balanced_long==1
	drop if trt_exp==4

	keep if inrange(etime, -12, 11)
	keep if months_since>=12 & months_until>=12
		
	global wage ln_avg_wage_exact
	label variable ln_avg_wage_exact "log average hourly wage"
	
	* Program ------------------------------------------------------------------

	* Define event study program
	cap program drop vmw_eventstudy
	program define vmw_eventstudy
		
		args outcome ytitle restriction expname controls subdirectory filename
		
		if !regexm("`filename'", "fig") {
			local filename "`outcome'_`expname'"
		}
		
		reghdfe `outcome' $common if balanced_long == 1 & (`restriction'), absorb(`controls') vce(cluster cz)
		PlotCoeff,  title(" ") xline(-0.5) xline(-2.5) vrs("T_") yti(`ytitle') name(`expname')
		graph export "$figures_tables/`subdirectory'`filename'.pdf", replace  
		
	end	

	cap program drop vmw_eventstudy_wage
	program define vmw_eventstudy_wage
		
		args outcome ytitle restriction expname controls subdirectory filename
		
		if !regexm("`filename'", "fig") {
			local filename "`outcome'_`expname'"
		}
		
		reghdfe `outcome' $common if balanced_long == 1 & (`restriction'), absorb(`controls') vce(cluster cz)
		PlotCoeff,  title(" ") xline(-0.5) xline(-2.5) vrs("T_") yti(`ytitle') name(`expname')  ylabel(-.002 0 .002 .004 .006 .008 .01)
		graph export "$figures_tables/`subdirectory'`filename'.pdf", replace  
		
	end		
	
	* Run ----------------------------------------------------------------------

	* Fig D6
	* All establishments
	preserve
	keep if mw==15
	egen T_std=std(T)
	replace T=T_std	
	
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"
		
	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw==15" "figd4" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "appendix/" "figd6a_spillover_wage_15_all_12mos"
	tab trt_exp if e(sample)==1
	restore

	* Fig D6
	* Sample industry only
	preserve
	keep if mw==15 & sample_ind==1
	egen T_std=std(T)
	replace T=T_std	
	
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"

	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw==15 & sample_ind==1" "figd4" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "appendix/" "figd6b_spillover_wage_15_sample_ind_12mos"
	tab trt_exp if e(sample)==1
	restore
	
	* Fig D6
	* Sample industry only
	preserve
	keep if mw==15 & (poaching_estab==1 | feeder_estab==1)
	egen T_std=std(T)
	replace T=T_std	
	
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"

	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw == 15 & (poaching_estab==1 | feeder_estab==1)" "figd4" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "appendix/" "figd6c_spillover_wage_15_pos_flows_12mos"
	tab trt_exp if e(sample)==1
	restore
	
	*------------------------------------------------------------------------------------------------------------%	
	* Figure 8: Effect of large retailer $15 MW on wages at other employers in CZ 
	*------------------------------------------------------------------------------------------------------------%	
	
	* Preliminaries ------------------------------------------------------------
	
	use "$data/cb/stacked_nonpolicy_firm_dataset.dta", clear
	keep if balanced_short==1
	drop if trt_exp==4
		
	keep if inrange(etime, -6, 5)
	global wage ln_avg_wage_exact
	label variable ln_avg_wage_exact "log average hourly wage"

	* Programs ------------------------------------------------------------------
	
	* Define event study program
	cap program drop vmw_eventstudy
	program define vmw_eventstudy
		
		args outcome ytitle restriction expname controls subdirectory filename
		
		if !regexm("`filename'", "fig") {
			local filename "`outcome'_`expname'"
		}
		
		reghdfe `outcome' $common if balanced_short == 1 & (`restriction'), absorb(`controls') vce(cluster cz)
		PlotCoeff,  title(" ") xline(-0.5) xline(-2.5) vrs("T_") yti(`ytitle') name(`expname')
		graph export "$figures_tables/`subdirectory'`filename'.pdf", replace  
		
	end	

	cap program drop vmw_eventstudy_wage
	program define vmw_eventstudy_wage
		
		args outcome ytitle restriction expname controls subdirectory filename
		
		if !regexm("`filename'", "fig") {
			local filename "`outcome'_`expname'"
		}
		
		reghdfe `outcome' $common if balanced_short == 1 & (`restriction'), absorb(`controls') vce(cluster cz)
		PlotCoeff,  title(" ") xline(-0.5) xline(-2.5) vrs("T_") yti(`ytitle') name(`expname') ylabel(-.0004 0 .0004 .0008 .0012 .0016 .0020 .0024 .0028)
		graph export "$figures_tables/`subdirectory'`filename'.pdf", replace  
		
	end		
		
	* Run ----------------------------------------------------------------------

	* All non-policy establishments
	preserve
	keep if mw==15
	egen sg_std=std(super_gap)
	replace T=sg_std	
		
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"
		
	* Fig 8
	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw==15" "fig7" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "" "fig8a_sg_spillover_wage_15_all"
	tab trt_exp if e(sample)==1
	restore
	
	* Sample industries
	preserve
	keep if mw==15 & sample_ind==1
	egen sg_std=std(super_gap)
	replace T=sg_std	
		
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"
	
	* Fig 8
	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw==15 & sample_ind==1" "fig7" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "" "fig8b_sg_spillover_wage_15_sample_ind"
	tab trt_exp if e(sample)==1
	restore
	
	* Connected establishments
	preserve
	keep if mw==15 & (poaching_estab==1 | feeder_estab==1)
	egen sg_std=std(super_gap)
	replace T=sg_std	
		
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"

	* Fig 5
	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw == 15 & (poaching_estab==1 | feeder_estab==1)" "fig7" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "" "fig8c_sg_spillover_wage_15_pos_flows"
	tab trt_exp if e(sample)==1	
	restore
	
	*------------------------------------------------------------------------------------------------------------%	
	* Figure D7: Longer time horizon, market gap
	*------------------------------------------------------------------------------------------------------------%	

	* Preliminaries ------------------------------------------------------------

	use "$data/cb/stacked_nonpolicy_firm_dataset.dta", clear
	keep if balanced_short==1
	drop if trt_exp==4

	keep if inrange(etime, -12, 11)
	*keep if months_since>=12 & months_until>=12
		
	global wage ln_avg_wage_exact
	label variable ln_avg_wage_exact "log average hourly wage"
	
	* Program ------------------------------------------------------------------

	* Define event study program
	cap program drop vmw_eventstudy
	program define vmw_eventstudy
		
		args outcome ytitle restriction expname controls subdirectory filename
		
		if !regexm("`filename'", "fig") {
			local filename "`outcome'_`expname'"
		}
		
		reghdfe `outcome' $common if balanced_long == 1 & (`restriction'), absorb(`controls') vce(cluster cz)
		PlotCoeff,  title(" ") xline(-0.5) xline(-2.5) vrs("T_") yti(`ytitle') name(`expname')
		graph export "$figures_tables/`subdirectory'`filename'.pdf", replace  
		
	end	

	cap program drop vmw_eventstudy_wage
	program define vmw_eventstudy_wage
		
		args outcome ytitle restriction expname controls subdirectory filename
		
		if !regexm("`filename'", "fig") {
			local filename "`outcome'_`expname'"
		}
		
		reghdfe `outcome' $common if balanced_long == 1 & (`restriction'), absorb(`controls') vce(cluster cz)
		PlotCoeff,  title(" ") xline(-0.5) xline(-2.5) vrs("T_") yti(`ytitle') name(`expname')  ylabel(-.0004 0 .0004 .0008 .0012 .0016 .0020 .0024 .0028)
		graph export "$figures_tables/`subdirectory'`filename'.pdf", replace  
		
	end		
	
	* Run ----------------------------------------------------------------------

	* Fig D7
	* All establishments
	preserve
	keep if mw==15
	egen sg_std=std(super_gap)
	replace T=sg_std	
	
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"
		
	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw==15" "figd5" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "appendix/" "figd7a_sg_spillover_wage_15_all_12mos"
	tab trt_exp if e(sample)==1
	restore

	* Fig D7
	* Sample industry only
	preserve
	keep if mw==15 & sample_ind==1
	egen sg_std=std(super_gap)
	replace T=sg_std	
	
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"

	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw==15 & sample_ind==1" "figd5" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "appendix/" "figd7b_sg_spillover_wage_15_sample_ind_12mos"
	tab trt_exp if e(sample)==1
	restore
	
	* Fig D7
	* Sample industry only
	preserve
	keep if mw==15 & (poaching_estab==1 | feeder_estab==1)
	egen sg_std=std(super_gap)
	replace T=sg_std	
	
	* Create interaction terms between trtvar and timevar, common to both period, omit -1
	EHTrtVars, prefix("T_") trtvar("T") omit("m1") timevar("etime")
	local common "`r(trtvars)'" 
	di wordcount("`common'") " treatment effects: `common'"
	global common "`common'"

	local varname: variable label $wage
	vmw_eventstudy_wage $wage "Effect on `varname'" "mw == 15 & (poaching_estab==1 | feeder_estab==1)" "figd5" "i.cmp_company_code#i.cz#i.trt_exp i.cmp_company_code#i.trt_exp i.cz#i.trt_exp i.etime#i.trt_exp" "appendix/" "figd7c_sg_spillover_wage_15_pos_flows_12mos"
	tab trt_exp if e(sample)==1
	restore
